import Vue from 'vue';
import Vuex from 'vuex';
import home from '@/store/modules/home';
import login from '@/store/modules/login';
import createPersistedState from 'vuex-persistedstate';

Vue.use(Vuex);

const store = new Vuex.Store({
  state: {
    liveId: '',
    sceneType: '0',
  },
  mutations: {
    initLiveInfo(state, data) {
      state.liveId = data.liveId || state.liveId;
      state.sceneType = data.sceneType || state.sceneType;
    },
  },
  modules: {
    home,
    login,
  },
  plugins: [createPersistedState()], // vuex 持久化存储
});

export default store;
